package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.SupplierMapper;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SupplierServiceimpl implements SupplierService {

    @Autowired
    SupplierMapper supplierMapper;

    @Override
    //分页查询供应商
    public ArrayList<Supplier> list(Integer page, Integer rows, String supplierName) {
               return  supplierMapper.list(page,rows,supplierName);
    }

    //保存
    @Override
    public void save(Supplier supplier) {
          //判断非空
          if ( supplier!=null){
              supplierMapper.save(supplier);
          }
    }

    //修改
    @Override
    public void update(Supplier supplier) {
        //判断非空
        if ( supplier!=null){
            supplierMapper.update(supplier);
        }
    }

    //删除
    @Override
    public void delete(Integer ids) {
         supplierMapper.delete(ids);
    }

    //供应商下拉列表查询
    @Override
    public List<Supplier> getComboboxList(String q) {
         return   supplierMapper.getComboboxList(q);
    }


}
